package c.main.controller;

import c.main.core.HttpView;
import c.main.core.IAuthorization;
import c.main.core.WebRequest;
import c.main.domain.LoginUser;
import sun.font.TrueTypeFont;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import java.io.IOException;

/**
 * Author: chengwei
 * Date:   2016/3/22
 * Time:   11:25
 */
@WebServlet(urlPatterns = "/user/home.action")
public class UserController extends BaseController{

    @WebRequest(act = "do_admin_login")
    public void doLoginAdmin(HttpView view) throws ServletException, IOException {
        view.getSession().removeAttribute(IAuthorization.SESSION_KEY);
    }

    @Override
    public void doDefaultGet(HttpView view) throws ServletException, IOException {
        LoginUser user = (LoginUser)view.getSession().getAttribute(IAuthorization.SESSION_KEY);
//        view.forwardJsp("sys/adminLogin");
        //view.getRequest().getRequestDispatcher("/WEB-INF/jsp/sys/adminLogin.jsp").forward(view.getRequest(),view.getResponse());
        view.forwardJsp("sys/adminLogin");
    }
}
